﻿using ITXHWEB.Models;
using ReflectionStudio.Core.Events;
using System;
using System.Data;
using System.Web.Mvc;
using WPFExcelReport;
using WPFExcelReport.Helpers;
using ITXHWEB.Infrastructure;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
namespace ITXHWEB.Controllers
{
    public partial class ABARTEController
    {

        [ChildActionOnly]
        public ActionResult MUA(string returnUrl)
        {
            ModelState.Clear();
            ViewBag.ReturnUrl = returnUrl;
            return PartialView(MABF);
        }
        [HttpPost]
        [AllowAnonymous]
        [ValidateAntiForgeryToken]
        public ActionResult MUA(ABFOLGEModel model, string returnUrl)
        {
            try
            {
                ModelState.Clear();
                READAM();
            }
            catch (Exception ex)
            {
                INFO = ex.Message;
                Tracer.Error(ex.StackTrace, ex);
            }
            return RedirectToAction(MAPP, MAPP);
        }
         
        public void READAM()
        {
            if (MABF.ABES == null)
                return;
            foreach (ABARTEModel item in MABF.ABES)
            {
                PM["INTERVAL"] = item.INTERVAL;
                PM["MSETID"] = item.MSETID;
                PM["CHANNEL"] = item.BDEKEN;
                PM["VALUE"] = item.MNOWTXTV;
                VHP.ABP.READAM(PM);
            }
            INFO = "已开始监控";
        }
    }
}
